import 'package:app/core/rtc/impl/session.dart';
import 'package:app/page/chat/entity/message.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:get/get.dart';

class ChatState {
  List<Message> message;

  Rx<Session> session;
  RxString title;

  RxBool isCalling;
  RxBool isMuteMic;
  RxString rtcStatus;

  RxString callPeerID;
  RxString callDuration;
  Rx<RTCVideoRenderer> localRender;
  Rx<RTCVideoRenderer> remoteRender;

  ChatState() {
    message = <Message>[].obs;
    for (int i = 0; i < 13; i++) {
      if (i % 2 == 0) {
        message.add(Message('msg', '$i 不会对子组件产生任何限制，它允许其子组件按照其本身大小绘制 ', true));
      } else if (i % 3 == 0) {
        message.add(Message(
            'msg', ' $i 给子元素指定了宽高，但是仍然没有效果时，几乎可以断定：已经有父元素已经设置了限制', false));
      } else {
        message.add(Message('msg', '$i 答案是否定的！所以在此提示读者难 ', false));
      }
    }

    rtcStatus = "".obs;
    isCalling = false.obs;
    isMuteMic = false.obs;
    title = ''.obs;
    session = Session().obs;
    callPeerID = ''.obs;
    callDuration = ''.obs;
    localRender = RTCVideoRenderer().obs;
    remoteRender = RTCVideoRenderer().obs;
  }
}
